package com.tenc.feign.contacts;

import com.tenc.bean.contacts.Staff;
import com.tenc.pojo.ErrorJson;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author Alan
 * @date 2021/7/20
 * @description 通讯录管理
 * @ClassName ContactsService
 */
@Component
@FeignClient(name = "contactsService",url = "${wechat.company.url}")
public interface ContactsService {

    /**
     * 创建成员
     * @param query access_token
     * @param staff 成员信息
     * @return 操作结果
     */
    @PostMapping("/user/create")
    ErrorJson createStaff(@SpringQueryMap Map<String,String> query , @RequestBody Staff staff);

    /**
     * 查看成员
     * @param query
     * @return 成员信息
     */
    @GetMapping("/user/get")
    Staff query(@SpringQueryMap Map<String,String> query);

    /**
     * 更新成员信息
     * @param query access_token
     * @param staff 成员信息
     * @return 操作结果
     */
    @PostMapping("/user/update")
    ErrorJson updateStaff(@SpringQueryMap Map<String,String> query,@RequestBody Staff staff);

    /**
     * 删除成员
     * @param query access_token
     * @return 操作结果
     */
    @GetMapping("/user/delete")
    ErrorJson deleteStaff(@SpringQueryMap Map<String,String> query);

    /**
     * 批量删除成员
     * @param query access_token
     * @param useridlist 成员列表
     * @return 操作结果
     */
    @PostMapping("/user/batchdelete")
    ErrorJson batchDeleteStaff(@SpringQueryMap Map<String,String> query,@RequestBody String [] useridlist);

    /**
     * 获取部门成员
     * @param query {access_token,department_id,fetch_child}
     * @return 成员信息
     */
    @GetMapping("/user/simplelist")
    ErrorJson simpleListStaff(@SpringQueryMap Map<String,String> query);

    /**
     * 获取部门成员详情
     * @param query {access_token,department_id,fetch_child}
     * @return 成员信息
     */
    @GetMapping("/user/list")
    ErrorJson simpleListStaffDetail(@SpringQueryMap Map<String,String> query);

    /**
     * userid转openid
     * @param params 企业内的成员id
     * @return openid
     */
    @PostMapping("/user/convert_to_openid")
    ErrorJson convertOpenId(@SpringQueryMap Map<String,String> query,@RequestBody Map<String,String> params);

    /**
     * openid转userid
     * @param query 调用接口凭证
     * @param params 在使用企业支付之后，返回结果的openid
     * @return userid
     */
    @PostMapping("/user/convert_to_userid")
    ErrorJson convertUserId(@SpringQueryMap Map<String,String> query,@RequestBody Map<String,String> params);

    /**
     * 二次验证
     * @param params
     * @return
     */
    @GetMapping("/user/authsucc")
    ErrorJson authSuccessStaff(@SpringQueryMap Map<String,String> params);

    /**
     * 邀请成员
     * @param query
     * @return
     */
    @PostMapping("/batch/invite")
    ErrorJson batchInvite(@SpringQueryMap Map<String,String> query,@RequestBody Map<String,String> params);

    /**
     * 获取加入企业二维码
     * @param params
     * @return
     */
    @GetMapping("/corp/get_join_qrcode")
    ErrorJson joinQrcode(@SpringQueryMap Map<String,String> params);

    /**
     * 获取企业活跃成员数
     * @param query
     * @param params
     * @return
     */
    @PostMapping("/user/get_active_stat")
    ErrorJson activeStaff(@SpringQueryMap Map<String,String> query,@RequestBody Map<String,String> params);
}
